package com.yanqu.road.server.cmd.zhaoshang;

import com.yanqu.road.pb.zhaoshang.ZhaoShangProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.zhaoshang.ZsMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_ZS_PROJECT_RANK_LIST, desc = "排行榜")
public class ZsWeekRankListCmd extends AbstractCommand {

    private int rankType;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        ZhaoShangProto.ZsWeekRankListReqMsg reqMsg = ZhaoShangProto.ZsWeekRankListReqMsg.parseFrom(packet.getBytes());
        rankType = reqMsg.getRankType();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ZhaoShangProto.CrossZsWeekRankListReqMsg.Builder crossReqMsg = ZhaoShangProto.CrossZsWeekRankListReqMsg.newBuilder();
        crossReqMsg.setRankType(rankType);
        int weekId = ZsMgr.getThisWeekId();
        crossReqMsg.setWeekId(weekId);
        player.sendPacket(Protocol.C_ZHAO_SHANG_PROJECT_RANK_LIST, crossReqMsg);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
